home *** CD-ROM | disk | FTP | other *** search
File List | 1980-01-09 | 13.1 KB | 620 lines |
- '
- ' OOPS! v1.01 BFH Ascii recovery program by Dave Groves and Dan Rhea
- '
- ' This program will traverse a disk a sector at a time and optionally allow
- ' the sector to be copied to a file on another disk
- '
- ' 01/09/89 - Added UnTwist and ReTwist. These alter the boot sector to and from
- ' a normal and twisted format. Only double sided is supported in
- ' this version. The nest will also handle single sided.
- '
- ' Set up and greet the sucker... er I mean user
- '
- Cls
- Showm
- @Nowrap
- @Inv
- @Zapl(1)
- @Zapl(25)
- @Cent("OOPS! v1.01 Micro Floppy Recovery Utility - David G. Groves & Dan Rhea",1)
- @Nor
- @Cent("OOPS! v1.01 (c) 1988, 1989 by David G. Groves & Dan Rhea",12)
- @Cent("This program may be copied but may never be sold",13)
- @Inv
- @Cent("Press any key to continue...",25)
- @Nor
- Got$=""
- While Got$=""
- Got$=Inkey$
- Wend
- '
- ' Initialize a few things...
- '
- Maxsect%=2
- Sector%=0
- Ctlz$=Chr$(26)
- Cluster%=1
- Fspec$="C:\*.*"
- Filename$=""
- Thefile$=""
- Cdrive%=-1
- Buffer1$=String$(512,0)
- Buffer2$=String$(512,0)
- Buflen%=1024
- Buff1%=Varptr(Buffer1$)
- Buff2%=Varptr(Buffer2$)
- Rawb%=0
- '
- ' Put up the main menu and get the selection
- '
- @Zapl(12)
- @Zapl(13)
- @Inv
- @Zapl(25)
- @Nor
- @Cent("Please select one of the following program options...",10)
- @Cent("(U)n-Twist a double sided Turtle disk with normal image data on it",12)
- @Cent("(R)e-Twist a double sided Turtle disk with Twister image data on it",13)
- @Cent("(S)ector to file scan, analyse and copy",14)
- @Inv
- Kack=False
- While Kack=False
- @Cent("(U)n-Twist, (R)e-Twist or (S)ector to file recovery ",25)
- Cmd$=Chr$(Inp(2))
- If Cmd$="U" Or Cmd$="u" Then
- @Untwist
- Else
- If Cmd$="R" Or Cmd$="r" Then
- @Retwist
- Else
- If Cmd$="S" Or Cmd$="s" Then
- Kack=True
- Else
- Print Chr$(7);
- Endif
- Endif
- Endif
- Wend
- @Zapl(25)
- @Nor
- For I=10 To 14
- @Zapl(I)
- Next I
- '
- ' Which drive shall we tamper with?
- '
- Afile=False
- While Cdrive%=-1
- @Inv
- @Cent("Enter source drive (A or B ONLY) ",25)
- D$=Chr$(Inp(2))
- If D$="A" Or D$="a" Then
- Cdrive%=0
- Else
- If D$="B" Or D$="b" Then
- Cdrive%=1
- Endif
- Endif
- Wend
- @Zapl(25)
- @Nor
- '
- ' Grab a sector from the selected disk and display it
- '
- @Wrap
- While Rawb%=0
- @Nowrap
- If Sector%>=Maxsect% Then
- Sector%=Maxsect%
- Endif
- Rawb%=Bios(4,2,L:Buff1%,Cluster%,Sector%,Cdrive%)
- '
- ' If this is the boot sector then get the max number of them on the disk
- '
- If Sector%=0 Then
- Max1%=(Peek(Buff1%+&H14) And &HFF)*256
- Maxsect%=Peek(Buff1%+&H13)+Max1%-1
- Endif
- @Inv
- @Zapl(25)
- @Showsect
- @Inv
- @Cent("Return/Enter to continue, Esc to command menu...",25)
- @Nor
- @Zapl(6)
- '
- ' Check for and announce an EOF if we find one in this sector
- '
- If Instr(Buffer1$,Ctlz$) Then
- @Cent("** EOF Detected in this sector **",6)
- Print At(0,0);Chr$(7);
- Endif
- Ok=False
- While Ok=False
- '
- ' Pause here just to be irritating
- '
- Got$=""
- While Got$=""
- Got$=Inkey$
- Wend
- '
- ' If we get an Escape put up the command prompt
- '
- If Got$=Chr$(27)
- Ok=True
- If Afile=False
- @Inv
- @Cent("E(X)it, (F)ile, (B)ack a sector, (G)oto sector Or (C)ontinue",25)
- I$=Chr$(Inp(2))
- @Nor
- '
- ' Check for Quit
- '
- If I$="X" Or I$="x" Then
- Cls
- @Wrap
- Edit
- Else
- '
- ' Check for file create
- '
- If I$="F" Or I$="f" Then
- @Newfile
- Else
- '
- ' Check for move back one sector
- '
- If I$="B" Or I$="b" Then
- Sector%=Sector%-Cluster%
- If Sector%<=0 Then
- Sector%=-1
- Else
- Sector%=Sector%-1
- Endif
- Else
- '
- ' Check for a GOTO sector
- '
- If I$="G" Or I$="g" Then
- @Zapl(6)
- @Cent2("Enter desired sector ? ",6)
- Print "Enter desired sector ";
- Input Sec%
- If Sec%>Maxsect% Then
- Sec%=Maxsect%
- Endif
- Sector%=Sec%-1
- @Zapl(6)
- Endif
- Endif
- Endif
- Endif
- @Inv
- @Cent("Return/Enter to continue, Esc to command menu...",25)
- @Nor
- Else
- '
- ' Display the "processing file" command prompt
- '
- @Inv
- @Cent("(E)nd of File, or (C)ontinue",25)
- I$=Chr$(Inp(2))
- @Nor
- '
- ' Check for end of this file
- '
- If I$="E" Or I$="e" Then
- @Endfile
- Afile=False
- Endif
- @Inv
- @Cent("Return/Enter to continue, Esc for command menu...",25)
- @Nor
- Endif
- Endif
- '
- ' See if we just got a vanillia Return
- '
- If Got$=Chr$(13)
- Ok=True
- Endif
- Wend
- '
- ' If we have an active file then copy a sector to it
- '
- If Afile=True
- @Addfile
- Endif
- '
- ' Move to next sector and reset buffers
- '
- Sector%=Sector%+Cluster%
- I%=0
- While I%<513
- Poke Buff1%+I%,0
- Poke Buff2%+I%,0
- Inc I%
- Wend
- Wend
- '
- ' If a file is still open then close it
- '
- If Afile=True Then
- Close #1
- Endif
- '
- ' Take off eh...
- '
- Cls
- @Wrap
- Edit
- ' -----------------------------------------------------------------------------
- ' ShowSect - Show the sector just read
- '
- Procedure Showsect
- @Nor
- @Zapl(9)
- @Wrap
- @Curs(1,9)
- '
- ' Show some status info
- '
- Print "Sector number ";Sector%;" RWABS Status ";Rawb%;" Sectors ";Maxsect%;
- '
- ' Move everything from the working buffer to the display buffer but rotate any
- ' unprintible characters to a "."
- '
- C%=0
- While C%<512
- S%=Peek(Buff1%+C%)
- If S%<32 Or S%>126
- If S%<129
- S%=46
- Endif
- Endif
- Poke Buff2%+C%,S%
- Inc C%
- Wend
- '
- ' Display the display buffer
- '
- @Curs(1,10)
- For P%=1 To 80
- Print "_";
- Next P%
- Print Buffer2$
- For P%=1 To 80
- Print "_";
- Next P%
- @Nowrap
- Return
- ' -----------------------------------------------------------------------------
- ' NewFile - Get the name of the newfile and open it.
- '
- Procedure Newfile
- Fileselect Fspec$,Filename$,Thefile$
- If Thefile$="" Then
- Afile=False
- Sector%=Sector%-Cluster%
- Else
- Open "O",#1,Thefile$
- Afile=True
- Endif
- Return
- ' -----------------------------------------------------------------------------
- ' AddFile - Add a sector to the open file.
- '
- Procedure Addfile
- @Inv
- @Cent("Writing current sector to file...",25)
- Bput #1,Buff1%,512
- @Nor
- @Curs(1,20)
- Print "Added 512 bytes to ";Thefile$;" (last sector shown)"
- Return
- ' -----------------------------------------------------------------------------
- ' EndFile - End the current file
- '
- Procedure Endfile
- Close #1
- Sector%=Sector%-Cluster%
- @Zapl(20)
- Return
- ' -----------------------------------------------------------------------------
- '
- ' Untwist - Convert a disk with a Twisted boot sector but normal data to normal
- '
- Procedure Untwist
- '
- ' Set up a loop so we can do a whole heap a disks
- '
- Imdone=False
- While Imdone=False
- '
- ' Setup the screen for displau
- '
- @Inv
- @Zapl(25)
- @Nor
- For I=10 To 14
- @Zapl(I)
- Next I
- Sector%=0
- Cdrive%=-1
- '
- ' Find out which drive we will be dealing with
- '
- While Cdrive%=-1
- @Inv
- @Cent("Enter source drive (A or B ONLY) ",25)
- D$=Chr$(Inp(2))
- If D$="A" Or D$="a" Then
- Cdrive%=0
- Else
- If D$="B" Or D$="b" Then
- Cdrive%=1
- Endif
- Endif
- Wend
- @Zapl(25)
- @Nor
- '
- ' Get and show the boot sector
- '
- Rawb%=Bios(4,2,L:Buff1%,Cluster%,Sector%,Cdrive%)
- Max1%=(Peek(Buff1%+&H14) And &HFF)*256
- Maxsect%=Peek(Buff1%+&H13)+Max1%-1
- @Showsect
- @Zapl(20)
- @Curs(1,20)
- '
- ' Verify the format of the boot sector
- '
- Print Hex$(Peek(Buff1%+19));" ";Hex$(Peek(Buff1%+20));" ";Hex$(Peek(Buff1%+24));
- If Peek(Buff1%+19)=&H40 And Peek(Buff1%+20)=&H6 And Peek(Buff1%+24)=&HA Then
- '
- ' Modify it to normal format
- '
- Poke Buff1%+19,&HA0
- Poke Buff1%+20,&H5
- Poke Buff1%+24,&H9
- Rawb%=Bios(4,3,L:Buff1%,Cluster%,Sector%,Cdrive%)
- @Showsect
- '
- ' Clear the buffer
- '
- I%=0
- While I%<513
- Poke Buff1%+I%,0
- Poke Buff2%+I%,0
- Inc I%
- Wend
- Else
- '
- ' Argh! This is not Twisted...
- '
- @Inv
- @Cent("Error: Disk does not have a Twister boot sector! Any key to Quit...",25)
- Print Chr$(7);
- While Inkey$=""
- Wend
- '
- ' Bail out
- '
- @Nor
- Cls
- Edit
- Endif
- '
- ' Pass on the good news
- '
- @Inv
- @Cent("Disk is patched. Shall we do another? (Y/N) ",25)
- Cmd$=Chr$(Inp(2))
- @Nor
- '
- ' Fix up the screen for the next victim
- '
- For I=9 To 20
- @Zapl(I)
- Next I
- If Cmd$<>"Y" And Cmd$<>"y" Then
- Imdone=True
- Else
- @Inv
- @Zapl(25)
- @Nor
- Endif
- Wend
- @Nor
- @Cent("Warning! Once the data is recovered from these disks, they MUST be",10)
- @Cent("re-formatted before they can be used again!",11)
- Cls
- Edit
- Return
- ' -----------------------------------------------------------------------------
- '
- ' Retwist - Convert a disk with a normal boot sector but Twisted data to Twisted
- '
- Procedure Retwist
- '
- ' Set up so we can keep processing disks
- '
- Imdone=False
- While Imdone=False
- @Inv
- @Zapl(25)
- @Nor
- For I=10 To 14
- @Zapl(I)
- Next I
- Sector%=0
- '
- ' Find the volenteer
- '
- Cdrive%=-1
- While Cdrive%=-1
- @Inv
- @Cent("Enter source drive (A or B ONLY) ",25)
- D$=Chr$(Inp(2))
- If D$="A" Or D$="a" Then
- Cdrive%=0
- Else
- If D$="B" Or D$="b" Then
- Cdrive%=1
- Endif
- Endif
- Wend
- '
- ' Get the boot sector
- '
- @Zapl(25)
- @Nor
- Rawb%=Bios(4,2,L:Buff1%,Cluster%,Sector%,Cdrive%)
- Max1%=Peek(Buff1%+&H14)*256
- Maxsect%=Peek(Buff1%+&H13)+Max1%-1
- @Showsect
- @Zapl(20)
- @Curs(1,20)
- '
- ' Verify it's normalcy
- '
- Print Hex$(Peek(Buff1%+19));" ";Hex$(Peek(Buff1%+20));" ";Hex$(Peek(Buff1%+24));
- If Peek(Buff1%+19)=&HA0 And Peek(Buff1%+20)=&H5 And Peek(Buff1%+24)=&H9 Then
- '
- ' Modify it to a twisted boot sector
- '
- Poke Buff1%+19,&H40
- Poke Buff1%+20,&H6
- Poke Buff1%+24,&HA
- Rwab%=Bios(4,3,L:Buff1%,Cluster%,Sector%,Cdrive%)
- @Showsect
- '
- ' Clear out the buffers
- '
- I%=0
- While I%<513
- Poke Buff1%+I%,0
- Poke Buff2%+I%,0
- Inc I%
- Wend
- Else
- '
- ' Dis ain't no steenkin normal boot sector
- '
- @Inv
- @Cent("Error: Disk does not have a normal boot sector! Any key to Quit...",25)
- Print Chr$(7);
- While Inkey$=""
- Wend
- '
- ' Like take off dude fer sure
- '
- @Nor
- Cls
- Edit
- Endif
- '
- ' Pass on the joyous news
- '
- @Inv
- @Cent("Disk is patched. Shall we do another? (Y/N) ",25)
- Cmd$=Chr$(Inp(2))
- @Nor
- '
- ' Set up for the next disk
- '
- For I=9 To 20
- @Zapl(I)
- Next I
- If Cmd$<>"Y" And Cmd$<>"y" Then
- Imdone=True
- Else
- @Inv
- @Zapl(25)
- @Nor
- Endif
- Wend
- @Nor
- @Cent("Warning! Once the data is recovered from these disks, they MUST be",10)
- @Cent("re-formatted before they can be used again!",11)
- Cls
- Edit
- Return
- ' ========================== screen library v1.01 =============================
- '
- ' Inv - Set Inverse Video
- '
- Procedure Inv
- Print Chr$(27);"p";
- Return
- '
- ' Nor - Set Normal Video
- '
- Procedure Nor
- Print Chr$(27);"q";
- Return
- '
- ' Tcol(Col) - Set text color
- '
- Procedure Tcol(Col)
- If Col>-1 And Col<4 Then
- Print Chr$(27);"b";Chr$(Col);
- Endif
- Return
- '
- ' Bcol(Col) - Set background color
- '
- Procedure Bcol(Col)
- If Col>-1 And Col<4 Then
- Print Chr$(27);"c";Chr$(Col);
- Endif
- Return
- '
- ' Cent(str) - Center "str" on the current line
- '
- Procedure Cent(Ctex$,Lin)
- @Zapl(Lin)
- Tlen%=Len(Ctex$)
- Padd%=(80-Tlen%)/2
- Print At(Padd%,Lin);Ctex$;
- Return
- '
- ' Cent2(str) - figure center and set cursor there for normal print
- '
- Procedure Cent2(Ctex$,Lin)
- @Zapl(Lin)
- Tlen%=Len(Ctex$)
- Padd%=(80-Tlen%)/2
- @Curs(Padd%,Lin)
- Return
- '
- ' Zapl(line) - Blank the line at line indicated
- '
- Procedure Zapl(Lin)
- For Zapp=1 To 80
- Print At(Zapp,Lin);" ";
- Next Zapp
- @Curs(1,Lin)
- Return
- '
- ' Curs(x,y) - Set cursor to X,Y
- '
- Procedure Curs(Crx,Cry)
- Print At(Crx,Cry);"";
- Return
- '
- ' Nowrap - turn off end of line wraparound
- '
- Procedure Nowrap
- Print At(0,0),Chr$(27);"w";
- Return
- '
- ' Wrap - reset eol wraparound
- '
- Procedure Wrap
- Print At(0,0),Chr$(27);"v";
- Return
- End
-